<?php namespace Home\Controller; 

use Hdphp\Controller\Controller;

//测试控制器
class IndexController extends CommonController{

	//构造函数
	public function __init()
	{
	}
	
    //动作
    public function index(){
    	//上衣的所有数据
    	$GoodssyData = Db::table('goods')->where('typeattr_lid',1)->limit(8)->get();
//		p($GoodssyData);
		View::with("GoodssyData",$GoodssyData);
		//鞋子的所有数据
		$GoodxzyData = Db::table('goods')->where('typeattr_lid',10)->limit(8)->get();
//		p($GoodxzyData);
		View::with("GoodxzyData",$GoodxzyData);
		//获取服饰分类子级
		$CatezijiData = Db::table('cate')->where('cfid',0)->limit(2)->get();
		foreach ($CatezijiData as $k => $v) {
			$CatezijiData[$k]['ziji'] = Db::table('cate')->where('cfid',$v['cid'])->limit(5)->orderBy('csort','ASC')->get();
		}
		/*foreach ($CatezijiData as $k => $v) {
			$CatezijiData[] = $CatezijiData->join('cate', 'cfid','=',$v['cid'])->limit(5)->orderBy('csort','ASC')->get();
		}*/
//		p($CatezijiData);
		View::with("CatezijiData",$CatezijiData);
		//获取鞋子分类
		$Catexz = Db::table('cate')->where('oftype_lid',10)->where('cfid',0)->pluck('cid');
		$CatexzzijiData = Db::table('cate')->where('oftype_lid',10)->where('cfid',$Catexz)->get();
		foreach ($CatexzzijiData as $k => $v) {
			$CatexzzijiData[$k]['ziji'] = Db::table('cate')->where('cfid',$v['cid'])->limit(5)->orderBy('csort','ASC')->limit(3)->get();
		}
//		p($CatexzzijiData);
		View::with("CatexzzijiData",$CatexzzijiData);
		//获取器材色所有子级
		$Cateqc = Db::table('cate')->where('oftype_lid',2)->where('cfid',0)->pluck('cid');
		$CateqczijiData = Db::table('cate')->where('cfid',$Cateqc)->get();
//		p($CateqczijiData);
		View::with('CateqczijiData',$CateqczijiData);
		//获取器材的数据
		$GoodsqcData = Db::table('goods')->where('typeattr_lid',2)->limit(8)->get();
//		p($GoodxzyData);
		View::with("GoodsqcData",$GoodsqcData);
       	View::make();
    }
}
